import 'package:flutter/material.dart';


class DataTableDemo extends StatefulWidget {
  @override
  _DataTableDemoState createState() => _DataTableDemoState();
}
 
class _DataTableDemoState extends State<DataTableDemo> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('DataTableDemo'),
        elevation: 0.0,
      ),
      body: Container(
        padding: EdgeInsets.all(16.0),
        child: ListView(
          children: <Widget>[
            DataTable(
              columns: [
              DataColumn(label: Text("Title")),
              DataColumn(label: Text('Anthor')),
            ], 
            rows: [
              DataRow(cells: [
                DataCell(Text("hello ~"),onTap:(){print("hello");}),
                DataCell(Text("liuan"),onTap:(){print("a");}),
              ]),
              DataRow(cells: [
                DataCell(Text("hi~")),
                DataCell(Text("futao")),
              ]),
              DataRow(cells: [
                DataCell(Text("a ~")),
                DataCell(Text("zuguo")),
              ]),
            ]),
          ],
        ),
      ),
    );
  }
}
